package com.only4play.authcenter.constants;

import com.only4play.common.constants.BaseEnum;

import java.util.Optional;

/**
 * @author hinzzz www.hinzzz.cn 157957329@qq.com
 * 2024-03-05
 */
public enum ThirdPartyAuthType implements BaseEnum<ThirdPartyAuthType> {
  
  QQ(1, "QQ"),
  GITHUB(2, "GITHUB("),
  DING_TALK(3, "钉钉"),
  WECHAT(4, "微信"),
  WEIBO(5, "微博"),
  WECHAT_OPEN(6, "微信开放平台"),
  WECHAT_MINI_PROGRAM(7, "微信小程序"),
  WECHAT_MINI_PROGRAM_APP(8, "微信小程序app"),
  WECHAT_MINI_PROGRAM_WEB(9, "微信小程序web"),
  WECHAT_MINI_PROGRAM_WEB_APP(10, "微信小程序webapp"),
    ;

  ThirdPartyAuthType(Integer code, String name) {
    this.code = code;
    this.name = name;
  }

  private Integer code;
  private String name;

  @Override
  public Integer getCode() {
    return this.code;
  }

  @Override
  public String getName() {
    return this.name;
  }

  public static Optional<ThirdPartyAuthType> of(Integer code) {
    return Optional.ofNullable(BaseEnum.parseByCode(ThirdPartyAuthType.class, code));
  }

}
